/********************************************************/
/*	Copyright (C) 2016 Gong Li Bin		 	*/
/*	Project:	GoLib-1.0.0			*/
/*	Author:		gong_libin			*/
/*	Date:		2016_01_01			*/
/*	File:		GoSetTest.go			*/
/********************************************************/

package main

import (
	. "GoGlb"
	C "GoCap"
)

type GoDisk struct {
	disk	string
	info	string
	list	string
}

func main() {
	i := C.GoInt{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
	f := C.GoFlt{9.9, 8.8, 7.7, 6.6, 5.5, 4.4, 3.3, 2.2, 1.1, 0}
	s := C.GoStr{"jj", "ii", "hh", "gg", "ff", "ee", "dd", "cc", "bb", "aa"}

	GoPrtln(i)
	i.GoSetSort()
	GoPrtln(i)

	GoPrtln(f)
	f.GoSetSort()
	GoPrtln(f)

	GoPrtln(s)
	s.GoSetSort()
	GoPrtln(s)

	a := C.GoInt{1, 5, 8, 9, 11, 22, 35, 56, 67, 88, 91, 101}
	GoPrtln(a)
	GoPrtln(a.GoSetFind(35))

	u := C.GoInt{1, 2, 2, 3, 5, 5, 5, 7, 8, 9, 9, 11, 12, 12 ,12, 13}
	GoPrtln(u)
	r := u.GoSetUniq().([]interface{})
	GoPrtln(r)
	C.GoSetOrder(r)
	GoPrtln(r)

	/* idd */
	od := C.GoObj{
		{5, GoDisk{"dk05", "if05", "ls05"}},
		{2, GoDisk{"dk04", "if04", "ls04"}},
		{2, GoDisk{"dk03", "if03", "ls03"}},
		{2, GoDisk{"dk02", "if02", "ls02"}},
		{1, GoDisk{"dk01", "if01", "ls01"}},
	}
	GoPrtln(od)
	od.GoSetSort()
	GoPrtln(od)
	od.GoSetUniq()
	GoPrtln(od)
	od.GoSetOrder()
	GoPrtln(od)
	GoPrtln(od[od.GoSetFind(3)])

	/* ids */
	os := C.GoObj{
		{"0005", GoDisk{"dk05", "if05", "ls05"}},
		{"0002", GoDisk{"dk04", "if04", "ls04"}},
		{"0002", GoDisk{"dk03", "if03", "ls03"}},
		{"0002", GoDisk{"dk02", "if02", "ls02"}},
		{"0001", GoDisk{"dk01", "if01", "ls01"}},
	}
	GoPrtln(os)
	os.GoSetSort()
	GoPrtln(os)
	os.GoSetUniq()
	GoPrtln(os)
	os.GoSetOrder()
	GoPrtln(os)
	GoPrtln(os[os.GoSetFind("0002")])
}
